import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:part_time_job_pro/common/base/base.dart';
import 'package:part_time_job_pro/pages/offer/state.dart';

class OfferLogic extends BaseController with GetSingleTickerProviderStateMixin {
  final OfferState state = OfferState();

  //tabbar控制
  late TabController tabController;

  @override
  void onInit() {
    tabController = TabController(length: 3, vsync: this);
    tabController.addListener(() {
      state.currentIndex = tabController.index; //只是下标 需要拿到ID
      state.currentId = state.tabBarList[state.currentIndex]["id"] as int?;
      state.currentName =
          state.tabBarList[state.currentIndex]["name"] as String?;
      debugPrint("currentId====>>>${state.currentId}");
      debugPrint("currentName====>>>${state.currentName}");
      update();
    });
    super.onInit();
  }

  @override
  void onClose() {
    tabController.dispose();
    super.onClose();
  }
}
